import React from 'react';
import { Fab } from '@mui/material';
import { Add } from '@mui/icons-material';
import Tooltip from './Tooltip';

interface NetPyNEAddNewProps {
  id?: string;
  title?: string;
  handleClick?: () => void;
}

const NetPyNEAddNew: React.FC<NetPyNEAddNewProps> = ({
  id,
  title = 'Create rule',
  handleClick,
}) => {
  const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
    if (handleClick) {
      event.stopPropagation();
      handleClick();
    }
  };

  return (
    <Tooltip title={title} placement="top">
      <Fab
        size="small"
        color="primary"
        id={id}
        onClick={handleButtonClick}
        sx={{ borderRadius: '50%', color: 'white' }}
      >
        <Add />
      </Fab>
    </Tooltip>
  );
};

export default NetPyNEAddNew;

